using System;
using System.Collections;
using InfoJetSoft.Service.Entity;

namespace InfoJetSoft.Service.ManagedCode
{
	/// <summary>
	/// Summary description for TaskPane.
	/// </summary>
	public class TaskPanes : Microsoft.Office.Interop.InfoPath.SemiTrust.TaskPanesCollection
	{
		private Form form = null;
		private ArrayList taskPaneList = null;

		public TaskPanes( Form frm )
		{
			this.form = frm;
			this.taskPaneList = new ArrayList();
			if( this.form.Manifest.TaskPaneList != null )
			{
				foreach( TaskPane taskPane in this.form.Manifest.TaskPaneList )
				{
					TaskPaneObject taskPaneObj = new TaskPaneObject( this.form, taskPane );
					this.taskPaneList.Add( taskPaneObj );
				}
			}
		}
		
		public IEnumerator GetEnumerator()
		{
			return this.taskPaneList.GetEnumerator();
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.TaskPane this[object varIndex] 
		{
			get
			{
				if( varIndex is int )
				{
					return (Microsoft.Office.Interop.InfoPath.SemiTrust.TaskPaneObject)this.taskPaneList[ (int)varIndex ];
				}
				return null;
			}
		}

		public int Count 
		{
			get
			{
				return this.taskPaneList.Count;
			} 
		}

	}
}
